'use client'

import {useEffect} from 'react'
import {Button} from "@nextui-org/react";

export default function Error({
                                  error,
                                  reset,
                              }: {
    error: Error
    reset: () => void
}) {
    useEffect(() => {
        // Log the error to an error reporting service
        console.error(error)
    }, [error])

    return (
        <div className={"flex flex-col justify-center items-center min-h-[80vh]"}>
            <div className={"mb-4"}>
                <p className={"font-bold text-2xl "}>页面加载错误</p>
                <p className={"text-sm text-gray-500"}>发生不可预测的小问题</p>
            </div>
            <Button color={'primary'}
                    onClick={
                        // Attempt to recover by trying to re-render the segment
                        () => reset()
                    }
            >
                点击重试
            </Button>
        </div>
    )
}
